<?php
	foreach (glob("../_CORE/_CLASS/peer/*.php") as $filename)
	{
		//echo $filename."<br />";
		include $filename;
	}

	foreach (glob("../_CORE/_CLASS/*.php") as $filename)
	{
		//echo $filename."<br />";
		include $filename;
	}
session_start();
ini_set('display_errors', 1);
//@error_reporting(0);
@set_time_limit(0);

include "kt_login.php";
include "../config.php";
$db = new lg_mysql($host,$dbuser,$dbpass,$csdl);
include "kt_admin.php";
include "function.php";
if ($da_dang_nhap)
{
if (empty($act)) $act = "home";
include "tpl/skin/header.php";
	include "tpl/skin/menu.php";
	echo "<div id=\"main_frame\">";
	
	// BREADCRUM
	$actCheck = "?act=".$act;
	$breadcrum = "";
	for ($index1 = 0; $index1 < count($menu); $index1 ++)
	{
		$l1 = $link[$index1];
		for ($index2 = 0; $index2 < count($l1); $index2 ++)
		{
			$l2 = $link1[$index1][$index2];
			//echo $link[$index1][$index2];
			if (substr($link[$index1][$index2],0,strlen($actCheck)) == $actCheck)
			{
				$breadcrum = " &nbsp; &raquo; &nbsp; ".$name[$index1][$index2];
				break;
			}
			else if (count($l2) > 0) {
				for ($index3 = 0; $index3 < count($l2); $index3 ++)
				{
					$l3 = $link2[$index1][$index2][$index3];
					if (substr($link1[$index1][$index2][$index3],0,strlen($actCheck)) == $actCheck)
					{
						$breadcrum = " &nbsp; &raquo; &nbsp; <a href='".$link[$index1][$index2]."'>".$name[$index1][$index2]."</a>";
						$breadcrum .= " &nbsp; &raquo; &nbsp; ".$name1[$index1][$index2][$index3];
						break;
					}
					else if (count($l3) > 0) {
						for ($index4 = 0; $index4 < count($l3); $index4 ++)
						{
							$l4 = $link2[$index1][$index2][$index3][$index4];
							if (substr($l4,0,strlen($actCheck)) == $actCheck)
							{
								$breadcrum = " &nbsp; &raquo; &nbsp; <a href='".$link[$index1][$index2]."'>".$name[$index1][$index2]."</a>";
								$breadcrum .= " &nbsp; &raquo; &nbsp; <a href='".$link1[$index1][$index2][$index3]."'>".$name1[$index1][$index2][$index3]."</a>";
								$breadcrum .= " &nbsp; &raquo; &nbsp; ".$name2[$index1][$index2][$index3][$index4];
								break;
							}
						}
					}
				}
			}
		}
	}
	if ($breadcrum) {
	?>
	<div style='padding:5px 0; font-size:12px; font-weight:bold;'>
		<a href="/admin/">Quản trị</a>
		<?
			echo $breadcrum;
		?>
	</div>
	<?
	}
	if (is_file("prog/".$act.".php"))
		include "prog/".$act.".php";
	else
		echo "<b>Chức năng này đã bị Khóa.</b>";
	echo "</div>";
	include "tpl/skin/copyright.php";
include "tpl/skin/footer.php";
}
else	include "login.php";
?>